package com.itheima.health.dao;

import com.itheima.health.pojo.Menu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface MenuDao extends Mapper<Menu> {
    @Select("SELECT t5.* FROM t_user t1 JOIN t_user_role t2 ON t1.id = t2.user_id JOIN t_role t3 ON t2.role_id = t3.id JOIN t_role_menu t4 ON t3.id = t4.role_id JOIN t_menu t5 ON t4.menu_id = t5.id WHERE t1.id = #{id} and level = 1")
    List<Menu> findSelectByUserId(@Param("id") Integer id);
    @Select("SELECT * FROM t_menu WHERE  parentMenuId = #{id1}")
    List<Menu> findSelectByParentMenuId(@Param("id1") Integer id1);
}
